package com.xy.entity.product;


import com.xy.common.jpa.AbstractTimestampEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;


import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;


@Entity
@Data
@Table(name = "product")
@EqualsAndHashCode(exclude = {"picture", "parameter","rent"})

public class Product extends AbstractTimestampEntity{

    @ApiModelProperty(value="标题",name="title")
    private String title;
    @ApiModelProperty(value="押金",name="cashpledge")
    private Float cashpledge;

    @OneToMany(cascade = CascadeType.ALL, mappedBy = "product", fetch = FetchType.EAGER)
    private List<Rent> rent = new ArrayList<>();//外键关联租价表

    @OneToMany(cascade = CascadeType.ALL, mappedBy = "product", fetch = FetchType.EAGER)
    private Set<Picture> picture = new HashSet<>();//外键关联图片表

    @OneToMany(cascade = CascadeType.ALL, mappedBy = "product", fetch = FetchType.EAGER)
    private Set<Parameter> parameter = new HashSet<>();//外键关联参数表



   
}
